﻿using System;
using hr_1.Model;

namespace hr_1.ViewModel
{
    public class PersonalDocViewModel:ViewModelBase
    {
        #region Fields

        readonly PersonalDoc _personalDoc = new PersonalDoc();

        #endregion // Fields

        #region Constructor

        public PersonalDocViewModel() { }

        public PersonalDocViewModel(PersonalDoc personalDoc)
        {
            if (personalDoc == null)
                throw new ArgumentNullException("personalDoc");

            _personalDoc = personalDoc;
        }

        #endregion // Constructor

        #region PersonalDoc Properties

        public int PersonalDocId
        {
            get { return _personalDoc.PersonalDocId; }
        }

        public string PasspSeries
        {
            get { return _personalDoc.PasspSeries; }
            set
            {
                if (value == _personalDoc.PasspSeries)
                    return;
                _personalDoc.PasspSeries = value;
                base.OnPropertyChanged("PasspSeries");
            }
        }

        public string PasspNumber
        {
            get { return _personalDoc.PasspNumber; }
            set
            {
                if (value == _personalDoc.PasspNumber)
                    return;
                _personalDoc.PasspNumber = value;
                base.OnPropertyChanged("PasspNumber");
            }
        }

        public string PasspWho
        {
            get { return _personalDoc.PasspWho; }
            set
            {
                if (value == _personalDoc.PasspWho)
                    return;
                _personalDoc.PasspWho = value;
                base.OnPropertyChanged("PasspWho");
            }
        }

        public string PasspWhen
        {
            get { return _personalDoc.PasspWhen; }
            set
            {
                if (value == _personalDoc.PasspWhen)
                    return;
                _personalDoc.PasspWhen = value;
                base.OnPropertyChanged("PasspWhen");
            }
        }

        public string Birthplace
        {
            get { return _personalDoc.BirthPlace; }
            set
            {
                if (value == _personalDoc.BirthPlace)
                    return;
                _personalDoc.BirthPlace = value;
                base.OnPropertyChanged("Birthplace");
            }
        }

        public string MedPolicy
        {
            get { return _personalDoc.MedPolicy; }
            set
            {
                if (value == _personalDoc.MedPolicy)
                    return;
                _personalDoc.MedPolicy = value;
                base.OnPropertyChanged("MedPolicy");
            }
        }
        public string Inn
        {
            get { return _personalDoc.Inn; }
            set
            {
                if (value == _personalDoc.Inn)
                    return;
                _personalDoc.Inn = value;
                base.OnPropertyChanged("Inn");
            }
        }
        public string Snils
        {
            get { return _personalDoc.Snils; }
            set
            {
                if (value == _personalDoc.Snils)
                    return;
                _personalDoc.Snils = value;
                base.OnPropertyChanged("Snils");
            }
        }

        #endregion // PersonalDoc Properties

        public void Save()
        {
            _personalDoc.Save();
        }
    }
}
